/**
 * Copyright (c) 2010 David Hamrick, Guy Kopsombut, Emily Ross 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#import "TestCabDriver.h"

#import "CabDriver.h"

@implementation TestCabDriver

- (void)testCreateCabDriver
{
	CabDriver* cab = [[CabDriver alloc] init];
	[cab setName:@"Bob"];
	[cab setLatitude:@"36.12451"];
	[cab setLongitude:@"-86.804454"];
	[cab save];
	
	NSLog(@"cab driver = %@",[cab dict]);
	STAssertTrue([cab ID] != 0,@"Cab Drivers ID should not be 0");
	[cab release];

}

- (void)testDeleteAll
{
	[self testCreateCabDriver];
	[CabDriver deleteAll];
	NSArray* array = [CabDriver allCabDrivers];
	NSLog(@"array = %@",array);
	STAssertNotNil(array,@"Array should not be nil");
	STAssertTrue([array count]==0,@"There should be no cabs");
}

- (void)testGetAll
{
	[CabDriver deleteAll];
	[self testCreateCabDriver];
	[self testCreateCabDriver];
	[self testCreateCabDriver];
	NSArray* cabList = [CabDriver allCabDrivers];
	STAssertNotNil(cabList,@"Array Should not be nil");
	STAssertTrue([cabList count]==3,@"There should be 3 cabs");
}

- (void)testAddCabs
{
	[CabDriver deleteAll];
	
	CabDriver* cab = [[CabDriver alloc] init];
	[cab setName:@"Bob"];
	[cab setLatitude:@"36.12451"];
	[cab setLongitude:@"-86.804454"];
	[cab save];
	[cab release];
	
	[CabDriver deleteAll];
}




@end
